package cn.howxu.yichen_ovo.init;

import cn.howxu.yichen_ovo.YiChenOVO;
import cn.howxu.yichen_ovo.common.block.*;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;

import java.util.LinkedList;
import java.util.List;
import java.util.function.Supplier;

/**
 * @description: TODO
 * @author: HowXu
 * @date: 2025/9/14 13:38
 */
public class ModBlocks {
    public static final DeferredRegister<Block> REGISTER = DeferredRegister.create(ForgeRegistries.BLOCKS, YiChenOVO.MODID);
    public static final List<RegistryObject<Block>> BLOCKS = new LinkedList<>();

    public static RegistryObject<Block> CRAFTING = reg("crafting", CraftingStorage::new);
    public static RegistryObject<Block> UL = reg("ul", UL::new);

    public static RegistryObject<Block> ALBOOK = REGISTER.register("albook", ALBook::new);
    public static final RegistryObject<Block> FLAG = REGISTER.register("flag", () -> new CompletionistBannerBlock(BlockBehaviour.Properties.of().strength(1F).instrument(NoteBlockInstrument.BASS).noCollission().sound(SoundType.WOOD)));
    public static final RegistryObject<Block> FLAG_WALL = REGISTER.register("flag_wall", () -> new CompletionistWallBannerBlock(BlockBehaviour.Properties.of().strength(1F).instrument(NoteBlockInstrument.BASS).noCollission().sound(SoundType.WOOD)));

    public static RegistryObject<Block> WINE = REGISTER.register("wine", () -> new Wine(BlockBehaviour.Properties.of().strength(1F).instrument(NoteBlockInstrument.BASS).noCollission().sound(SoundType.WOOD)));

    private static RegistryObject<Block> reg(String name, Supplier<? extends Block> sup){
        RegistryObject<Block> e = REGISTER.register(name, sup);
        BLOCKS.add(e);
        return e;
    }
}
